feat(test): simplify macOS testing with automatic cross-compilation#9585
Merged
matthewmcneely merged 30 commits intomainfrom Feb 9, 2026
Merged
feat(test): simplify macOS testing with automatic cross-compilation#9585matthewmcneely merged 30 commits intomainfrom
matthewmcneely merged 30 commits intomainfrom
Conversation
On non-Linux systems, `make install` now automatically builds both: - Native binary at $GOPATH/bin/dgraph - Linux binary at $GOPATH/linux_<arch>/dgraph This eliminates the manual cross-compilation steps previously required for macOS users to run Docker-based integration tests. Introduces GOPATH_LINUX_BIN env var to locate the Linux binary.
- t/Makefile now uses GOPATH_LINUX_BIN for binary verification - t/t.go automatically sets GOPATH_LINUX_BIN based on runtime.GOOS - Add modular dependency check scripts in t/scripts/ The test runner now seamlessly works on macOS without manual environment variable setup.
Update all systest docker-compose.yml files to mount the dgraph binary from GOPATH_LINUX_BIN instead of hardcoded GOPATH/bin path. This enables Docker-based tests to find the correct Linux binary on both Linux and macOS systems.
- Add TESTING.md as comprehensive testing guide (renamed from TESTING_GUIDE.md) - Update CONTRIBUTING.md to link to TESTING.md with quick start examples - Simplify t/README.md macOS section to reflect automated build system - Add cross-references between documentation files The macOS testing instructions are now much simpler since the build system handles cross-compilation automatically.
Restore the witty ~~complex~~ sophisticated strikethrough and tighten prose while preserving voice. Move TESTING.md reference to end of section as a natural "learn more" exit ramp.
Add note explaining that manual installation isn't required since AUTO_INSTALL=true make check/test handles dependencies automatically.
- Add language specifier to code block (MD040) - Rename duplicate "How to Run" headings (MD024) - Remove trailing colons from anti-pattern headings (MD026)
Shorter, clearer name for the environment variable that specifies where Linux binaries are stored for Docker tests.
Add design document for unified `make test` entry point that supports: - Environment variables (TAGS, SUITE, PKG, TEST, FUZZ, FUZZTIME) - Helper targets (test-unit, test-integration2, etc.) - Auto-generated help from ## comments - Auto-discovery of fuzz test packages
Add three-way routing to the test target based on environment variables: - TAGS: bypass t/ runner, run go test directly with build tags - FUZZ: auto-discover and run fuzz tests in packages - SUITE (default): delegate to existing t/ runner Precedence: TAGS > FUZZ > SUITE The TAGS path is for integration2/upgrade tests that don't need the t/ runner's Docker Compose orchestration. The FUZZ path discovers packages containing Fuzz* functions and runs each with configurable FUZZTIME (default 300s).
- Change help output to use conventional Make syntax (make test VAR=value) - Add benchmark example showing PKG variable with test-benchmark - Update TESTING.md with all 11 test shortcuts and new syntax - Update CONTRIBUTING.md testing section with new examples - Align all documentation with current make help output
- Extract SUITE values from t/t.go's allowed list - Discover TAGS values by scanning test files for //go:build directives - Display both in make help output for better discoverability
…-all - Change i.e. examples to put vars after 'make test' (more intuitive) - Add test-all target for SUITE=all (completes helper target coverage) - Update TESTING.md to match new help output format - All SUITE and TAGS values now have corresponding helper targets
This comment has been minimized.
This comment has been minimized.
Run all 13 make test-* targets to validate the unified test interface. Results: 1 passed (test-fuzz), 12 failed due to Docker infrastructure issues on macOS arm64 and missing test data files.
- Rename duplicate "Examples" heading to "Go Test Examples" in TESTING.md - Remove docs/plans/ files that had hard tabs and other lint issues
Add appropriate shellcheck disable comments to suppress false positives: - SC2310: Functions in conditionals (intentional pattern) - SC2312: Masked return values (intentional) - SC2329: "Unused" functions (sourced by other scripts) - SC1091: Can't follow source (file exists at runtime)
matthewmcneely
requested changes
Feb 4, 2026
Add an explicit error when GOPATH is empty to prevent make install from writing to system root paths like /bin and /linux_arm64. Remove test-results-summary.md which was not meant to be checked in.
matthewmcneely
approved these changes
Feb 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR eliminates manual setup for running integration tests on macOS and introduces a unified test interface via Make.
Key Features
1. Automatic Cross-Compilation (macOS)
Previously, macOS developers had to manually cross-compile a Linux binary and juggle environment variables. Now,
make installhandles everything automatically.2. Unified Test Interface
A single
make testentry point that routes to the appropriate test runner based on variables:3. Convenient Shortcuts
Every SUITE and TAGS value has a corresponding helper target:
4. Dynamic Discovery
make helpdynamically discovers available SUITE values fromt/t.goand TAGS values from test file build directives.Changes
make installauto-detects the OS and builds both native and Linux binaries on non-Linux systemsmake testroutes to t/ runner orgo testbased onSUITE,TAGS,FUZZvariablestest-*targetmake helpshows available SUITE/TAGS values discovered from the codebaseLINUX_GOBINto specify where Linux binaries are stored for Docker tests${LINUX_GOBIN:-$GOPATH/bin}for binary mountingBefore (macOS)
After (macOS or Linux)
make install make test SUITE=systest PKG=systest/exportmake helpOutputTest plan
make installon macOS and verify both binaries are createdmake checkint/directorymake test-unitroutes to t/ runner with--suite=unitmake test TAGS=integration2 PKG=typesruns go test directlymake test FUZZ=1 PKG=dql FUZZTIME=5sruns fuzz testsmake test-benchmark PKG=typesruns benchmarksmake helpshows all targets, variables, and discovered SUITE/TAGS valuestest-*targettest-*target